package alog;

import java.util.*;

/**
 * 经典的动态规划问题
 * 最长子序列 牢记
 */

public class dp_子序列 {
    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] num = new int[n];
            for (int i = 0; i < n; i++) {
                num[i] = sc.nextInt();
            }
            int max_sum = 0;
            int[] dp = new int[n];
            Arrays.fill(dp,1);
            for (int i = 1; i < n; i++) {
                for (int j = 0; j < i; j++) {
                    if(num[i] > num[j])
                        dp[i] = Math.max(dp[i], dp[j] + 1);
                }
                max_sum = Math.max(max_sum, dp[i]);
            }
            System.out.println(max_sum);
            //最长递增子数组
            max_arrays(num);
        }

    /**
     * 最长递增子数组
     * @param num
     */
    public static void max_arrays(int[] num){
        int n = num.length;
        int[] dp = new int[n];
        int m = 0;
        Arrays.fill(dp, 1);
        for (int i = 1; i < n; i++) {
            if(num[i - 1] < num[i]){
                dp[i] = dp[i - 1] + 1;
            }
            m = Math.max(dp[i], m);
        }
        System.out.println(m);
    }
}
